<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Personal Blog</title>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <style>
        body {
            font-family: 'Poppins', sans-serif;
            background: #f4f4f4;
            color: #333;
            padding: 20px;
        }
        #blog-content {
            max-width: 800px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body>
    <h1>My Personal Blog</h1>
    <div id="blog-content">Loading blog content...</div>

    <script>
        // Function to load the Markdown file from the server
        function loadMarkdownFile(filePath) {
            fetch(filePath) // Make a fetch request to the markdown file
                .then(response => {
                    if (!response.ok) { // Check if the response is successful
                        throw new Error('Network response was not ok');
                    }
                    return response.text(); // Return the text content of the file
                })
                .then(markdownText => {
                    const htmlContent = marked(markdownText); // Convert markdown to HTML
                    document.getElementById('blog-content').innerHTML = htmlContent; // Insert the HTML into the page
                })
                .catch(error => {
                    document.getElementById('blog-content').innerHTML = 'Failed to load content: ' + error.message; // Handle errors
                });
        }

        // Load the Markdown file from the specified path
        loadMarkdownFile('/home/hrj/myweb/httpserver/wwwroot/mdFile/test.md');
    </script>
</body>
</html>
